﻿using Rapid.MvcExtension.Controllers;
using Rapid.Core.Aop;
using Rapid.Utility.Helper;
using Rapid.WebNecessary;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Rapid.MvcApplication.Areas.Manage.Controllers
{
    public class MenuFavoritesController : ManageController
    {
        public ActionResult Dialog()
        {
            return View();
        }

        public ActionResult Page()
        {
            return View();
        }

        public string Grid()
        {
            return JsonHelper.Serialize(ServiceFactory.BasicMenuFavorites.GetByUserId(SessionFactory.UserID));
        }

        public string Insert(string menuid)
        {
            return ServiceFactory.BasicMenuFavorites.Insert(menuid, SessionFactory.UserID).Serialize();
        }

        public string Remove(string id)
        {
            return ServiceFactory.BasicMenuFavorites.Delete(id).Serialize();
        }

        public string Clear()
        {
            return ServiceFactory.BasicMenuFavorites.ClearByUserId(SessionFactory.UserID).Serialize();
        }

        public string SetOrder(string id, string order)
        {
            return ServiceFactory.BasicMenuFavorites.Order(id, order, SessionFactory.UserID).Serialize();
        }
    }
}